package com.tiecode.plugin.pvz.action;

import android.graphics.drawable.Drawable;

import com.tiecode.develop.component.api.option.TieItem;
import com.tiecode.develop.component.api.option.TieMenu;
import com.tiecode.develop.component.widget.option.TieMenuItem;
import com.tiecode.develop.util.firstparty.image.DrawableUtils;
import com.tiecode.plugin.PluginEnvironment;
import com.tiecode.plugin.action.page.code.CodePageAction;
import com.tiecode.plugin.action.page.code.ProjectFilePageAction;
import com.tiecode.plugin.pvz.R;

import java.net.URI;

public class PVZCodePageAction extends CodePageAction {
    @Override
    public void onCreateToolMenu(TieMenu menu) {
        Drawable drawable = DrawableUtils.getDrawable(
                PluginEnvironment.getContext(this),
                R.drawable.ic_pvz
        );
        menu.addItem(new TieMenuItem("PVZ", drawable));
    }

    @Override
    public void onToolMenuClick(TieItem item) {
        if ("PVZ".equals(item.getTitle())) {
            openURI(URI.create("pvz://植物大战僵尸"));
        }
    }
}
